Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move env names to constant file #264

Merged
merged 2 commits into from
Jan 17, 2021

Conversation

heitorlessa
Copy link
Contributor

@heitorlessa heitorlessa commented Jan 15, 2021

Issue #, if available:

Description of changes:

All internal changes to ease new feature toggles, env var changes, ensures all choices pick explicit over env if available, etc.

non-truthy value options

# from
self.service = service or os.getenv("POWERTOOLS_SERVICE_NAME") or "service_undefined"

# to
self.service = resolve_env_var_choice(choice=service, 
                                      env=os.getenv(constants.SERVICE_NAME_ENV, "service_undefined"))

truthy value options

# from
log_event_env_option = str(os.getenv("POWERTOOLS_LOGGER_LOG_EVENT", "false"))
log_event = strtobool(log_event_env_option) or log_event

# to
log_event = resolve_truthy_env_var_choice(choice=log_event,
                                          env=os.getenv(constants.LOGGER_LOG_EVENT_ENV, "false")
)

simple env vars

# From
is_lambda_sam_cli = os.getenv("AWS_SAM_LOCAL")
is_chalice_cli = os.getenv("AWS_CHALICE_CLI_MODE")

# To
is_lambda_sam_cli = os.getenv(constants.SAM_LOCAL_ENV)
is_chalice_cli = os.getenv(constants.CHALICE_LOCAL_ENV)

Checklist

Breaking change checklist

RFC issue #:

  • Migration process documented
  • Implement warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@heitorlessa heitorlessa added the internal Maintenance changes label Jan 15, 2021
@heitorlessa heitorlessa requested a review from to-mc January 15, 2021 16:51
@codecov-io
Copy link

codecov-io commented Jan 15, 2021

Codecov Report

Merging #264 (4514cd0) into develop (e2ae79e) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #264      +/-   ##
===========================================
+ Coverage    99.74%   99.82%   +0.07%     
===========================================
  Files           78       78              
  Lines         2777     2790      +13     
  Branches       114      114              
===========================================
+ Hits          2770     2785      +15     
+ Misses           5        4       -1     
+ Partials         2        1       -1     
Impacted Files Coverage Δ
aws_lambda_powertools/logging/formatter.py 100.00% <100.00%> (ø)
aws_lambda_powertools/logging/logger.py 100.00% <100.00%> (ø)
aws_lambda_powertools/metrics/base.py 100.00% <100.00%> (ø)
...ws_lambda_powertools/middleware_factory/factory.py 100.00% <100.00%> (ø)
aws_lambda_powertools/shared/constants.py 100.00% <100.00%> (ø)
aws_lambda_powertools/shared/functions.py 100.00% <100.00%> (ø)
aws_lambda_powertools/tracing/tracer.py 100.00% <100.00%> (+1.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2ae79e...4514cd0. Read the comment docs.

@heitorlessa
Copy link
Contributor Author

Gonna merge this due to a) release tomorrow, and b) need to fix #262 and will use this to make new changes quicker

@heitorlessa heitorlessa merged commit 454d669 into aws-powertools:develop Jan 17, 2021
@heitorlessa heitorlessa deleted the chore/use-constants branch January 17, 2021 16:26
heitorlessa referenced this pull request in heitorlessa/aws-lambda-powertools-python Jan 17, 2021
* develop:
  chore: move env names to constant file (#264)
  docs: fix import (#267)
  feat: Add AppConfig parameter provider (#236)
  chore: update stale bot
  improv: override Tracer auto-capture response/exception via env vars (#259)
  docs: add info about extras layer (#260)
  feat: support extra parameter in Logger messages (#257)
  chore: general simplifications and cleanup (#255)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Maintenance changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants